// Canvas容器主样式
.canvasContainer {
  display: flex;
  height: calc(100vh - 100px);
  width: 100%;

  background-color: #f0f2f5;
  // 确保容器能完全撑满父元素
  position: relative;
  min-height: 0;
}

// 左侧元素库样式
.elementLibrary {
  width: 200px;
  background-color: #fff;
  border-right: 1px solid #e8e8e8;
  padding: 16px;
  box-sizing: border-box;
  overflow-y: auto;
  height: 100%;

  h3 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 500;
    color: #333;
  }

  .libraryItems {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .libraryItem {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border: 1px solid #e8e8e8;
    border-radius: 4px;
    cursor: grab;
    transition: all 0.3s ease;

    &:hover {
      background-color: #f5f5f5;
      border-color: #1890ff;
    }

    &:active {
      cursor: grabbing;
    }
  }

  .itemPreview {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    background-color: #f5f5f5;
  }

  .itemName {
    font-size: 14px;
    color: #333;
  }
}

// 右侧canvas画板区域样式
.canvasWrapper {
  flex: 1;
  position: relative;
  overflow: hidden;
  background-color: #fafafa;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  // 确保wrapper能完全撑满父元素
  min-height: 0;
}

// Canvas样式
.canvas {
  width: 100%;
  height: 100%;
  cursor: crosshair;
  background-color: #fff;
  border: 1px solid #e8e8e8;
  // 确保canvas能响应式缩放
  display: block;
}

// 拖拽提示样式
.dragHint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 12px 24px;
  border-radius: 4px;
  font-size: 16px;
  pointer-events: none;
  z-index: 1000;
}

// 选中元素信息面板样式
.selectedInfo {
  position: absolute;
  top: 16px;
  right: 16px;
  background-color: rgba(255, 255, 255, 0.95);
  padding: 12px 16px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  max-width: 200px;
  z-index: 999;

  p {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #333;
  }
}

// 删除按钮样式
.deleteBtn {
  width: 100%;
  padding: 6px 12px;
  background-color: #ff4d4f;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s ease;

  &:hover {
    background-color: #ff7875;
  }

  &:active {
    background-color: #d9363e;
  }
}

// 响应式设计
@media (max-width: 768px) {
  .canvasContainer {
    flex-direction: column;
  }

  .elementLibrary {
    width: 100%;
    height: 200px;
    border-right: none;
    border-bottom: 1px solid #e8e8e8;
  }

  .libraryItems {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .libraryItem {
    flex: 0 0 calc(50% - 6px);
  }
}
